package com.limbo.showapp.base;

import com.limbo.showapp.rxHttp.HttpService;
import com.limbo.showapp.rxHttp.HttpManager;

import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;


/**
 * 联网model
 * Created by wangqi on 2018/9/4.
 */

public class BaseModel {
    protected HttpService mHttpService;

    //ServiceManager使用了单例
    public BaseModel() {
        mHttpService = HttpManager.getInstance().creat(HttpService.class);
    }

    protected <T> Observable<T> observable(Observable<T> observable){
        return observable.subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }
}
